get_char(){
stty erase ^?
echo -e "0.退出\n1.第一步t\n2.第二步h\n3.第三步a\n4.一键删除[termux下]"
#stty erase '^H' && read -p "" num
#case "$num" in
read -r -p "请选择:" input
	case $input in
0)
exit
;;
1) 
[ `command -v git` ] || pkg install -y git
[[ `pkg list-all|grep ncurses-utils` ]] || pkg install -y ncurses-utils
cd $HOME
#[[ `du -s termux-alpine|awk '{print $1}'|grep 2819` ]] && AL=2819
if [[ -f ~/termux-alpine/setup-termux-alpine ]];then
cd termux-alpine
    rm -rf setup-termux-alpine
    curl https://gitee.com/ewf-9/BiJi/raw/master/setup-termux-alpine -o setup-termux-alpine
    chmod +x setup-termux-alpine
./setup-termux-alpine
else
    git clone -b main https://ghproxy.com/https://github.com/illvart/termux-alpine.git
    cd termux-alpine
    rm -rf setup-termux-alpine
    curl https://gitee.com/ewf-9/BiJi/raw/master/setup-termux-alpine -o setup-termux-alpine
    chmod +x setup-termux-alpine
./setup-termux-alpine
fi
cd
brc=`grep -qs "termux-alpine" ~/.bashrc`
if [ ptermux-alpine == p$brc ];then
echo "termux自启已存在"
else
#echo -e 'ht=`ps -ef |grep /ql/build/app.js|grep -v "grep" | wc -l`\nif [ 0 == $ht ];then\n[ -r /data/data/com.termux/files/usr/bin/termux-alpine ] && termux-alpine\nfi' >>~/.bashrc && \
cat > .bashrc <<- EOM
ht=\`ps -ef |grep /ql/build/app.js|grep -v "grep" | wc -l\`
if [ t0 == t\$ht ];then
[ -r /data/data/com.termux/files/usr/bin/termux-alpine ] && termux-alpine
fi
EOM
echo "termux自启写入成功"
fi
;;
2)
clear
echo -e "方法1.proot自启\n方法2./etc/profile.d/motd.sh，alpine自带文件自启\n两种方法都在termux自带bash执行"
#stty erase ^H && read -p "" num
#case "$num" in
read -r -p "请选择:" input
	case $input in
1)
grep -qs init.sh /data/data/com.termux/files/usr/bin/termux-alpine || [ -r ~/.alpine/boot/init.sh ] && sed -i '/--login/a\command+=\" /boot/init.sh\"' /data/data/com.termux/files/usr/bin/termux-alpine && \
echo "写入成功"
;;
2)
grep -qs init.sh .alpine/etc/profile.d/motd.sh || echo -e 'ht=`ps -ef |grep /ql/build/app.js|grep -v "grep" | wc -l`\nif [ 0 == $ht ];then\nnohup bash /boot/init.sh 2>&1 & \nfi' >>.alpine/etc/profile.d/motd.sh && \
echo "写入成功"
;;
*)
echo "请输入正确"
;;
esac
termux-alpine
;;
3)
cd /
[ `ls -lh /|grep 371M` ] || rm -f /file.tar.gz
TYLJ="https://189.ly93.cc/R3iUbaZbqqIr/51387114668985702?accessToken=FDE7C87A2949966E1F6CD750AABFA0AE"
[[ `curl -s $TYLJ|grep 解析分享信息` ]] && echo 链接过期，联系楼主 && exit
[ -r file.tar.gz ] || wget -O file.tar.gz --no-check-certificate $TYLJ
[ -r /boot/init.sh ] || tar -xvf file.tar.gz
echo "解压成功"
[ -r /boot/init.sh ] && bash /boot/* 
;;
4)
[ -r /data/data/com.termux/files/usr/bin/termux-alpine ] && rm -rf /data/data/com.termux/files/usr/bin/termux-alpine
[ `command -v tsu` ] || pkg install tsu -y
[ -e ~/.alpine/ ] && sudo rm -rf ~/.alpine
[ -e ~/termux-alpine/ ] && rm -rf ~/termux-alpine
#sed -i 's/.//g'
[[ `grep alpine ~/.bashrc` ]] && sed -i 's/.//g;s/[[:space:]] //;/^\s*$/d' ~/.bashrc
#echo '' >~/.bashrc
echo "删除成功"
;; 
*)
echo "请输入正确"
;;
esac
get_char
#stty erase ^?
}
get_char "$@"
#stty erase ^?